package main

import (
	"log"
	"os"
	"runtime/trace"
	"sync"
)

func main() {
	f, err := os.Create("test.out")
	var wg sync.WaitGroup
	if err != nil {
		log.Fatalln(err)
	}
	trace.Start(f)
	defer trace.Stop()
	num := 0

	for i := 0; i < 10000; i++ {
		wg.Add(1)
		go dos(&wg, &num)
	}
	wg.Wait()
	println("mian")
	println(num)
}

func dos(wg *sync.WaitGroup, num *int) {
	*num++
	wg.Done()
}
